#include "user_interface.h"



#if defined(HIGH_FREQUENCY_INJECTION)
u8 MciGetOntheflyStage(pMCI_t pMCI_Handle)
{
    return pMCI_Handle->pSpinMotion->pMCConf->pOnthefly->oStage;
}

#endif

void MciSetTorquePIController(pMCI_t pMCI_Handle, PI_t PIController)
{
    *pMCI_Handle->pFOC->pPITorq = PIController;
}
void MciSetFluxPIController(pMCI_t pMCI_Handle, PI_t PIController)
{
    *pMCI_Handle->pFOC->pPIFlux = PIController;
}

bool MciGetCalibStatus(pMCI_t pMCI_Handle)
{
    return pMCI_Handle->pStateFlag->bAlign_done;
}

bool MciGetHallStudyStatus(pMCI_t pMCI_Handle)
{
    return pMCI_Handle->pStateFlag->bHallStudy_done;
}

bool MciGetChargeStatus(pMCI_t pMCI_Handle)
{
    return pMCI_Handle->pStateFlag->bCharge_done;
}

bool MciGetPosSeekStatus(pMCI_t pMCI_Handle)
{
    return pMCI_Handle->pStateFlag->bCharge_done;
}

bool MciGetAlignStatus(pMCI_t pMCI_Handle)
{
    return pMCI_Handle->pStateFlag->bAlign_done;
}

bool MciGetOntheflyStatus(pMCI_t pMCI_Handle)
{
    return pMCI_Handle->pStateFlag->bOnTheFly_done;
}

bool MciGetStartupStatus(pMCI_t pMCI_Handle)
{
    return pMCI_Handle->pStateFlag->bStartup_done;
}

bool MciGetSwitchoverStatus(pMCI_t pMCI_Handle)
{
    return pMCI_Handle->pStateFlag->bSwitch_done;
}

bool MciGetStopStatus(pMCI_t pMCI_Handle)
{
    return pMCI_Handle->pStateFlag->bStop_done;
}

bool MciGetFaultStatus(pMCI_t pMCI_Handle)
{
    return pMCI_Handle->pStateFlag->bFault_done;
}


void MciCommandStart(pMCI_t pMCI_Handle)
{
    *pMCI_Handle->pCommand = CMD_START;
}

void MciCommandCalib(pMCI_t pMCI_Handle)
{
    *pMCI_Handle->pCommand = CMD_CALIB;
}

void MciCommandHallStudy(pMCI_t pMCI_Handle)
{
    *pMCI_Handle->pCommand = CMD_HALL_STUDY;
}

void MciCommandAlign(pMCI_t pMCI_Handle)
{
    *pMCI_Handle->pCommand = CMD_ALIGN;
}

void MciCommandStop(pMCI_t pMCI_Handle)
{
    *pMCI_Handle->pCommand = CMD_STOP;
}

void MciCommandAcknowledgeFault(pMCI_t pMCI_Handle)
{
    *pMCI_Handle->pCommand = CMD_ACK_FAULT;
}

void MciCommandCurrentLoop(pMCI_t pMCI_Handle)
{
    *pMCI_Handle->pCommand = CMD_CRT_REF;
}

void MciCommandVelocityLoop(pMCI_t pMCI_Handle)
{
    *pMCI_Handle->pCommand = CMD_VELO_REF;
}

u16 MciGetFault(pMCI_t pMCI_Handle)
{
    return pMCI_Handle->pMCFault->All;
}

#if defined(HIGH_FREQUENCY_INJECTION)
void MciSetHighFrequencyInjectionVoltage(pMCI_t pMCI_Handle, s16 hInjectVolt)
{
    pMCI_Handle->pSpinMotion->pVeloSensor->pHFI->hHfi_amp = hInjectVolt;
}

void MciSetHighFrequencyInjectionPhaseLockLoop(pMCI_t pMCI_Handle, PI_t Pll)
{
    *pMCI_Handle->pSpinMotion->pVeloSensor->pHFI->pll = Pll;
}
#endif

#if defined(VS_SMO)
void MciSetSlidingModeObserverK1(pMCI_t pMCI_Handle, s16 hK1)
{
    
}

#endif



























